from xlwt import Workbook

wb=Workbook('utf-8')
sheet=wb.add_sheet('部门表')

title=['部门编号','部门名称','部门地址']
for i in range(len(title)):
    sheet.write(0,i,title[i])

content=[
    [1, '研发部', '三楼'],
    [2, '测试部', '顶楼'],
    [3, '运维部', '负一楼']
]
for i in range(len(content)):
    for j in range(len(content[i])):
        sheet.write(i+1,j,content[i][j])
wb.save(r'H:\python\write_excle\excle3.xls')